package hu;

import java.util.*;

public class hu36 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] key = sc.nextLine().toLowerCase().toCharArray();
        char[] encode = sc.nextLine().toCharArray();
        int[] letter = new int[26];
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < key.length; i++) {
            if(letter[key[i] - 'a'] == 0){
                sb.append(key[i]);
                letter[key[i] - 'a'] = 1;
            }
        }
        for (int i = 0; i < 26 - sb.length(); i++) {
            for (int j = 0; j < 26; j++) {
                if(letter[j] == 0){
                    char ch = (char) ('a' + j);
                    sb.append(ch);
                    letter[j] = 1;
                }
            }
        }
        char[] pw = sb.toString().toCharArray();
        StringBuilder passWord = new StringBuilder();
        for (int i = 0; i < encode.length; i++) {
            if(encode[i] <= 'Z' && encode[i] >= 'A'){
                passWord.append(pw[encode[i] - 'A'] - 32);
            }
            else{
                passWord.append(pw[encode[i] - 'a']);
            }
        }
        System.out.println(passWord);
    }
}
